#pragma once


// OphiesDownLoadWnd
class CHTTPRemoteFile;

class COphiesDownLoadWnd : public CWnd
{
	DECLARE_DYNAMIC(COphiesDownLoadWnd)

public:
	COphiesDownLoadWnd();
	virtual ~COphiesDownLoadWnd();

protected:
	DECLARE_MESSAGE_MAP()
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);


public:
	void	SetDownLoadDirectory(CString strDir)				{ m_strDownLoadDirectory = strDir; }
	CString	GetDownLoadDirectory()								{ return m_strDownLoadDirectory; }

	void	SetDownLoadUrl(CStringArray& arrUrl)				{ m_arrDownLoadUrl.Copy( arrUrl ); }
	void	SetDownLoadDestFileName(CStringArray& arrDestName)	{ m_arrDownLoadDestFileName.Copy( arrDestName ); }

	void	ShowDownLoadWindow(BOOL bFlag);

	void	StartDownLoad();
	void	StopDownLoad();

	void	DownLoad();

	void	SetDownLoaded(BOOL bFlag)			{ m_bDownLoaded = bFlag; }
	BOOL	IsDownLoaded()						{ return m_bDownLoaded; }

protected:
	BOOL	IsExistCacheFile(CString strFilePath);

	static UINT WorkThread(LPVOID pParam);


	//Control member
protected:
	CProgressCtrl		m_ctrProgress;

	CWinThread*			m_pThread;

	CHTTPRemoteFile*	m_pRemote;

protected:
	CString				m_strDownLoadDirectory;
	CString				m_strServerUrl;

	CStringArray		m_arrDownLoadUrl;
	CStringArray		m_arrDownLoadDestFileName;

	int					m_nDownLoadCompleteFileCnt;
	int					m_nDownLoadFailFileCnt;

	BOOL				m_bDownLoaded;
};


typedef CArray<COphiesDownLoadWnd*, COphiesDownLoadWnd*> CDownLoadWndArray;
